﻿/*
	zealotwms 仓库管理系统
	Copyright (C) 2011  狂热者工作组 
    内容：TextBox自定义内容选择控件
    时间: 2011-9-6
    
*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Zwms.Client.CommonUI
{
    public partial class TextBoxSelectUC : UserControl
    {
        public delegate void SelectEventHandler(object sender,EventArgs e);
        public event SelectEventHandler SelectButtonClick;

        public TextBoxSelectUC()
        {
            InitializeComponent();
        }

        private void btnClear_Click(object sender, EventArgs e)
        {
            tbContent.Text = "";
            Tag = string.Empty;
        }

        private void btnSelect_Click(object sender, EventArgs e)
        {
            SelectButtonClick(sender, e);
        }

        public void SetTextBoxContent(string sContent)
        {
            tbContent.Text = sContent;
        }

        public string GetTextBoxContent()
        {
            return tbContent.Text.Trim();
        }

        public void SetEditState(bool b)
        {
            btnSelect.Enabled = b;
            btnClear.Enabled = b;
        }

        public void SetTextBGColor(Color c)
        {
            this.tbContent.BackColor = c;
        }
    }
}
